<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
	<meta name="google" content="notranslate">
	<title>文章新增</title>
	<link rel='stylesheet' id='global-css'  href='/css/style.css?ver=4.4.2' type='text/css' media='all' />
	<script type='text/javascript' src='/script/libs.min.js?ver=4.4.2'></script>
	<script type='text/javascript' src='/script/functions.js?ver=4.4.2'></script>
	<script type='text/javascript' src='/script/common.js'></script>
    <script type="text/javascript">
		$(document).ready(function () {
			// 发表文章功能绑定
			$(document).on("click", ".btn.btn-info", function(){
				addArticle();
			});
		});

	 	/**
		 * 请求结束回调函数，页面迁移
		 */
		function gotList(data){
			if(data.resCode == 1){
				window.open("article_list.html", "_self")
			} else {
				alert(data.resMessage);
			}
		}
		/**
		 * 新增评论
		 */
		function addArticle(){
			var url = "http://127.0.0.1/article/publish";
			var articleTitle = $("#articleTitle").val();
			var articleInfo = $("#articleInfo").val();
			var param = {
				"articleTitle": articleTitle
				,"articleInfo": articleInfo
			}
			ajax.post(url, param, gotList)
		}
    </script>
</head>
<body>
	<div id="wrap" class="wrap">
		<header id="header" class="header">
			<h1 class="logo">
				<a href="index.html"  id="admin-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="jk-Blog">
					<label>jk-Blog</label>
					<span class="css-arrow-bottom"></span>
				</a>
			</h1>
			<div class="right-side">
				<div class="news">
					<a href="">
						<label>3</label>
						<img class="js-svg" src="images/svg/info.svg">
					</a>
				</div>
				<div class="dropdown settings">
					<a class="button" id="settings" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="jk-Blog">
						<label class="avatar"><img src="images/logo-x.png" alt="da bai"></label>
						<span class="css-arrow-bottom"></span>
					</a>
					<ul class="dropdown-menu" aria-labelledby="settings">
						<li><a href="user-info.html">账号信息</a></li>
						<li><a href="notification-settings.html">通知设置</a></li>
						<li role="separator" class="divider"></li>
						<li><a class="small" href="login.html">退出</a></li>
					</ul>
				</div>
			</div>
		</header>

		<div class="container">
			<div class="ajax-container">

				<section class="content">
					<div class="ui-list ui-project-list" id="article-vue">
						<h1 class="section-heading">文章发表</h1>
						<div style="height: 20px;"></div>
						<fieldset class="form page-1">
							<div class="filter form-inline clearfix" data-ajax-next="true">
								<div class="form-group">
									<label for="articleTitle">文章名称</label>
									<div class="input">
									<input type="text" class="form-control" style="min-width: 450px; min-height: 50px;"
										   id="articleTitle" name="articleTitle">
									</div>
								</div>
							</div>
						</fieldset>
						<div style="height: 20px;"></div>
						<fieldset class="form page-2">
							<div class="form-group" style="padding-left: 50px;">
								<textarea class="form-control" style="width: 95%; height: 150px;" id="articleInfo"></textarea>
							</div>
						</fieldset>
						<div class="btn-col" style="text-align: center;">
							<button id="btn_addArticle" class="btn btn-info" style="min-width: 80px;margin-bottom: 50px;">发表文章</button>
						</div>
					</div>
				</section>
			</div>
		</div>


	</div>
</body>
</html>